<?php
class program{
     public $id=0;
}
class test{
     protected $arr=[];
     public function insert($name){
         $this->arr[$name]=function (){
           return new program();
         };
     }
     public function get($name){
         return $this->arr[$name]();
     }
}
$test=new test();
$test->insert('program');
$program=$test->get('program');
echo $program->id=1;
$program1=$test->get('program');
 $program1->id=1;
$program2=$test->get('program');
echo $program2->id;